#!/usr/bin/perl

# make a text file of 1934 fluxes from the current MIRIAD model
my $freq_min=10.0;
my $freq_max=60.0;
my $freq_interval=0.2;

open(FLUXES,">oldmodel_1934_fluxes.out");

for (my $i=$freq_min;$i<=$freq_max;$i+=$freq_interval){
    my $calplot_command="calplot source=1934-638 xrange=".
	($i-$freq_interval/2.0).",".($i+$freq_interval/2.0)." stokes=i".
	" device=/null";
    open(CALPLOT,"-|")||exec $calplot_command;
    while(<CALPLOT>){
	chomp;
	my @els=split(/\s+/);
	if ($els[0] eq "1934-638"){
	    print FLUXES "$els[2] $els[3]\n";
	}
    }
    close(CALPLOT);
}

close(FLUXES);
